package vn.demand.dragon.controller
{
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;
	
	import vn.demand.dragon.model.vo.ProjectFile;
	import vn.demand.dragon.view.ProjectFileUploadMediator;
	
	public class OpenProjectFileUploadCommand extends SimpleCommand
	{
		override public function execute( note:INotification ) :void    
		{
			if (!facade.hasMediator(ProjectFileUploadMediator.NAME)) {
				facade.registerMediator(new ProjectFileUploadMediator(ProjectFileUploadMediator.NAME));
			}
			var mediator:ProjectFileUploadMediator = facade.retrieveMediator(ProjectFileUploadMediator.NAME) as ProjectFileUploadMediator;
			
			var o:Object = note.getBody();
			var projectVO:Object = o.projectVO;
			if (o.file == null) {
				var file:ProjectFile = new ProjectFile();
				file.pfile_project = projectVO.project_id;
				o.file = file;
			}
			mediator.show(projectVO, o.file);
        }
	}
}